package thread;

/**
 * 使用匿名内部类创建线程
 */
public class ThreadDemo3 {
    public static void main(String[] args) {
        Thread t1 = new Thread(){
            public void run(){
                for (int i = 0; i < 10000; i++) {
                    System.out.println("你是谁？");
                }
            }
        };
        t1.start();



        /*Runnable r2 = new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 10000; i++) {
                    System.out.println("。。。");
                }
            }
        };
        Thread t2 = new Thread(r2);
        t2.start();*/


        Thread t2 = new Thread(()->{
         for (int i = 0; i < 10000; i++) {
                System.out.println("。。。");
            }
        });
        t2.start();

    }
}
